﻿using System.IO;
using System.ServiceModel;
using System.ServiceModel.Web;
using ZeCloud.Resto55.Business.Table;

namespace Resto55Business_WebRole
{
    // NOTE: If you change the interface name "IResto55Service" here, you must also update the reference to "IResto55Service" in Web.config.
    [ServiceContract]
    public interface IResto55Service
    {
        [OperationContract]
        [WebInvoke(UriTemplate = "resto/create?nom={nom}&departement={dep}&ville={ville}", Method = "POST")]
        Resto CreateResto55(string nom, int dep, string ville);

        [OperationContract]
        [WebInvoke(UriTemplate = "{in_restoUniqueId}/element/create?element={in_element}&categorie={in_categorie}&desc={in_description}", Method = "POST")]
        Element CreateElement(string in_restoUniqueId, string in_element, string in_categorie, string in_description);

        [OperationContract]
        [WebInvoke(UriTemplate = "{in_uniqueelementId}/prix?value={in_prix}", Method = "POST")]
        DetailPrix CreateElementPrice(string in_uniqueelementId, double in_prix);

        [OperationContract]
        [WebInvoke(UriTemplate = "create/parameters?resto={restoName}&departement={departement}&ville={ville}&element={elementName}&categorie={category}&description={description}&prix={prix}", Method = "POST")]
        bool CreateWithParameter(string restoName, string departement, string ville, string elementName, string category, string description, string prix);

        [OperationContract]
        [WebGet(UriTemplate = "search?q={name}", ResponseFormat = WebMessageFormat.Xml)]
        Resto[] GetRestoByQuery(string name);

        [OperationContract]
        [WebGet(UriTemplate = "resto?id={in_restoUniqueId}", ResponseFormat = WebMessageFormat.Xml)]
        Element[] GetElementByResto(string in_restoUniqueId);

        [OperationContract]
        [WebGet(UriTemplate = "element?id={in_uniqueelementId}", ResponseFormat = WebMessageFormat.Xml)]
        DetailPrix[] GetDetailPrixByElementId(string in_uniqueelementId);

        [OperationContract]
        [WebGet(UriTemplate = "help")]
        Stream GetHelp();

        [OperationContract]
        [WebInvoke(UriTemplate = "create/headers?mode=allinone", Method = "POST")]
        /// <summary>
        /// Creates a resto plus an element with a price all in one request
        /// </summary>
        /// <returns>True if successfully created</returns>
        bool CreateAllInOne();
    }
}
